import { ModalFuncProps, App } from 'antd'

export default function useConfirm() {
  const { modal } = App.useApp()

  /** 删除确认框 */
  function deleteConfirm(props: ModalFuncProps) {
    modal.confirm({
      title: '删除',
      content: '确定删除吗？',
      okText: '删除',
      okButtonProps: {
        type: 'default',
        danger: true
      },
      ...props
    })
  }

  /** 默认 */
  function confirm(props: ModalFuncProps) {
    modal.confirm({
      title: '确认',
      content: '是否确认改操作？',
      ...props
    })
  }

  return {
    confirm,
    deleteConfirm
  }
}
